home *** CD-ROM | disk | FTP | other *** search
- program mcb ;
-
- uses dos,crt ;
-
- type tblchar = array [1..16] of char ;
- str4 = string [4] ;
- str2 = string [2] ;
-
- const hextbl : array [0..15] of char = '0123456789ABCDEF' ;
-
- var p : ^tblchar ;
- regs : registers ;
- fin , psp : boolean ;
- valp : word ;
-
- function dec2hex (a : word) : str4 ;
-
- var s : str4 ;
-
- begin
- s [0] := chr (4) ;
- s [1] := hextbl [hi (a) shr 4] ;
- s [2] := hextbl [hi (a) and $0F] ;
- s [3] := hextbl [lo (a) shr 4] ;
- s [4] := hextbl [lo (a) and $0F] ;
- dec2hex := s ;
- end ;
-
- function char2hex (var c : char) : str2 ;
-
- var s : str2 ;
-
- begin
- s [0] := chr (2) ;
- s [1] := hextbl [ord (c) shr 4] ;
- s [2] := hextbl [ord (c) and $0F] ;
- char2hex := s ;
- end ;
-
- procedure showp ;
-
- var i : byte ;
-
- begin
- write (' ',p^[1],' ') ; { 'M' or 'Z' }
- asm mov ax,word ptr p+2
- mov es,ax
- mov ax,word ptr es:1
- mov valp,ax
- end ;
- write (valp:5,' ') ;
- asm mov ax,word ptr p+2
- mov es,ax
- mov ax,word ptr es:3
- mov valp,ax
- end ;
- write (valp:5,' ') ;
-
- for i := 6 to 16 do
- write (char2hex (p^[i]),' ') ;
-
- for i := 6 to 16 do
- if p^[i] <= ' ' then
- write ('¿')
- else
- write (p^[i]) ;
-
- asm mov ax,word ptr p+2
- mov valp,ax
- end ;
- write (' 0x',dec2hex (valp),' ') ;
-
- psp := false ;
- asm mov ax,word ptr p+2
- inc ax
- mov es,ax
- cmp word ptr es:0,$20CD { debut d'un PSP }
- jne @notPSP
- mov byte ptr psp,1 {true}
- @notPSP:
- end ;
- if psp then
- write (' ok') ;
- writeln ;
- end ;
-
- begin
- asm mov ah,$52
- int $21
- mov ax,es
- dec ax
- mov es,ax {es=es-1}
- { mov ax,es:[bx+12]
- mov word ptr p,ax } { l'offset = 0 !!! }
- mov ax,es:[bx+14]
- mov word ptr p+2,ax
- end ;
- fin := false ;
- writeln ('MZ|PSPowner|Para| Data not documented (Name of prog) |Segment|PSPfollow?') ;
- repeat
- showp ;
- if p^[1] = 'Z' then
- fin := true ;
- if not fin then
- asm mov ax,word ptr p+2
- mov es,ax
- inc ax
- add ax,es:3
- mov word ptr p+2,ax
- end ;
- until fin ;
- write (#13,#10,'PSPowner = 0 mean MCB free, PSPowner = 8 mean allocated by DOS, else PSPowner = ') ;
- write ('segment of the PSP owner for this MCB ... 1 Para = 16 byte !!! ... Coded by Sam') ;
- end.